import { Effect, ImmerReducer, Reducer, Subscription } from 'umi';

export interface IndexModelState {
    list: Array<any>;
}

export interface IndexModelType {
    namespace: 'banner';
    state: IndexModelState;
    reducers: {
        addCard: ImmerReducer<IndexModelState>
    }
}




const IndexModel: IndexModelType = {
    namespace: 'banner',
    state: {
        list: [],
    },
    reducers: {
        addCard(state: any, action) {
            // 值如果为数组的话，需要转换一下
            console.dir(state.list)
            state.list = Array.from(state.list)
            state.list.push(action.obj)
        }
    },
};

export default IndexModel;